package DemoLinkedHashMap;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

public class DemoLinkedHashMap {
    public static void main(String[] args) {
        Map<String, String> map1 = new LinkedHashMap<>();
        map1.put("1", "星期一");
        map1.put("2", "星期二");
        System.out.println(map1);
        String string = map1.get("2");
        System.out.println(string);

        String remove = map1.remove("1");
        System.out.println(map1);
        System.out.println(remove);

        boolean containsKey = map1.containsKey("2");
        System.out.println(containsKey);

        System.out.println("==========================");

        Map<Integer,Integer> map = new LinkedHashMap<Integer,Integer>();
        map.put(1,11);
        map.put(2,12);
        map.put(3,13);
        map.put(4,14);
        System.out.println(map);

        Set<Map.Entry<Integer, Integer>> entries = map.entrySet();
        for(Entry<Integer,Integer> entry : entries) {
            System.out.println(entry);
        }
    }
}
